package com.mp.approvalreq.util;

import com.mp.approvalreq.entity.Leave;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

public class LeaveUtils {

	public static Map<Integer, Leave> getLeaveMap(List<Leave> list) {
		return list.stream().collect(Collectors.toMap(Leave::getRequestId, leave -> leave, (a, b) -> b));
	}

	public static List<Integer> getRequestIds(List<Leave> leaves) {
		return leaves.stream().map(Leave::getRequestId).collect(Collectors.toList());
	}
}
